<!DOCTYPE html>
<html>

<head>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="ie=edge">
	<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0">
	<title>珠峰培训-CRM登录</title>
	<link rel="shortcut icon" href="images/icon.png" type="image/x-icon">
	<!-- IMPORT CSS -->
	<link rel="stylesheet" href="css/reset.min.css">
	<link rel="stylesheet" href="css/iconfont.css">
	<link rel="stylesheet" href="css/login.css">
</head>

<body>
	<main class="mainBox">
		<h1 class="title">CRM客户管理系统</h1>
		<p class="tip">为保护企业的数据安全，请妥善保管密码</p>
		<section class="loginBox">
			<div class="form">
				<i class="iconfont icon-yonghuming"></i>
				<input type="text" class="userName" placeholder="请输入用户名/手机号/邮箱">
			</div>
			<div class="form">
				<i class="iconfont icon-mima"></i>
				<input type="password" class="userPass" placeholder="请输入登录密码">
			</div>
			<button class="submit">登录</button>
		</section>
	</main>
	<footer class="footerBox">
		<span>北京珠峰世纪技术培训有限公司</span>
		<span>京ICP备09041920号</span>
		<span>京公网安备110108400531号</span>
	</footer>
	<script src="https://cdn.bootcss.com/qs/6.7.0/qs.min.js"></script>
	<script src="./js/axios.min.js"></script>
	<!-- <script src="https://code.jquery.com/jquery-3.1.1.min.js"></script> -->
	<script src="./js/jquery.min.js"></script>
	<script>
		console.log(Qs)

		let submit = document.getElementsByClassName('submit')[0];
		let userPass = document.getElementsByClassName('userPass')[0];
		let userName = document.getElementsByClassName('userName')[0];

		submit.onclick = function () {
			// console.log('1234567890:'+userPass.value)
			// console.log('周啸天:'+userName.value)
			// console.log(888)
			axios.post('http://127.0.0.1:8888/user/login',{
				account:userName,
				password:userPass
			},{
				transformRequest:[function(data){
					console.log(Qs.stringify(data))
					return Qs.stringify(data)
					// return data
				}],
				headers:{
					'Content-Type':'application/x-www-form-urlencoded'
				}
			}).then(value=>{
				if (value.data.code === 1){
					window.location.href="http://127.0.0.1:5500/client/index.html"

				}else {
					alert('失败')

				}
				console.log(value)
			},reason=>{
				console.log(reason)
			})
			// axios({
			// 	url:'http://127.0.0.1:8888/user/login',
			// 	method:'POST',
			// 	data:{
			// 		account:'周啸天', 
			// 		password:'1234567890'

			// 	}
			// }).then(value=>{
			// 	console.log(value)
			// 	if (value.data.code != 1){
					
			// 		window.location.href="http://127.0.0.1:5500/client/index.html"

			// 	}else {
			// 		alert(value.data.codeText)
					
			// 	}
			// },reason=>{
			// 	console.log(reason)
			// })
			

		}

	</script>


</body>

</html>